home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
taropyon
/
znsplay
/
src
/
znslib01.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-30
|
2KB
|
91 lines
#include <stdio.h>
#include <stdlib.h>
#include <egb.h>
#include <snd.h>
#include "znsplay.h"
int ZnsSwPort = 2;
#define _SND_BIOS
#ifndef _SND_BIOS
# define GET_SW { \
sw = ( (_inb( 0x4D0 ) & _inb( 0x4D2 )) ^ 0xFF) & 0x30; \
}
#else
# define GET_SW { \
int sw1, sw2; \
if ( ZnsSwPort & 1 ) \
SND_joy_in_1( 0, &sw1 ); \
else \
sw1 = 0x30; \
if ( ZnsSwPort & 2 ) \
SND_joy_in_1( 1, &sw2 ); \
else \
sw2 = 0x30; \
sw = ( ~(sw1 & sw2)) & 0x30; \
}
#endif
int ZnsNextCheck(void)
{
int sw;
/* 注意:sw 押されているとbit off 押されてないとbit on */
#ifndef _SND_BIOS
_outb( 0x4D6, 0xFF ); /* end check */
#endif
GET_SW;
if( sw == 0 )
return 0;
c01:
GET_SW;
if( sw & 0x10 )
{
while( sw == 0x30 )
{
GET_SW;
}
if( sw == 0x20 )
goto c02;
while( sw )
{
GET_SW;
if( sw == 0x30 )
break;
}
return 1;
}
c02:
if( sw )
goto c01;
return (-1);
}
void ZNS_cls(void)
{
DSP_writePage(0);
EGB_color( EgbPtr, 1, 0 );
EGB_clearScreen( EgbPtr );
DSP_writePage(1);
boxf( DspCtrl.scinf[1].sc.x1, DspCtrl.scinf[1].sc.y1 + 24,
DspCtrl.scinf[1].sc.x2, DspCtrl.scinf[1].sc.y2 - 16, PSET, 0 );
}
void ZNS_frame( FRAME *fr )
{
DSP_writePage(1);
DSP_view2( DspCtrl.scinf[1].sc.x1, DspCtrl.scinf[1].sc.y1 + 24,
DspCtrl.scinf[1].sc.x2, DspCtrl.scinf[1].sc.y2 - 16 );
box( fr->x1-1, fr->y1-1, fr->x2+1, fr->y2+1, PSET,C_MBLACK);
box( fr->x1-2, fr->y1-2, fr->x2+2, fr->y2+2, PSET,C_WHITE);
DSP_view( &(DspCtrl.scinf[1].sc) );
}